import 'package:flutter/material.dart';

class AppBarDemoSecondPage extends StatefulWidget {
  AppBarDemoSecondPage({Key key}) : super(key: key);

  @override
  _AppBarDemoSecondPageState createState() => _AppBarDemoSecondPageState();
}

class _AppBarDemoSecondPageState extends State<AppBarDemoSecondPage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 6,
        child: Scaffold(
          appBar: AppBar(
            // title: Text('AppBarDemoSecondPage'),

            // backgroundColor: Colors.red,
            // leading: Icon(Icons.menu),
            centerTitle: true,
            // leading: IconButton(
            //   icon: Icon(Icons.menu),
            //   onPressed: (){
            //     print('menu');
            //   },
            // ),
            // actions: <Widget>[
            //   IconButton(
            //     icon: Icon(Icons.search),
            //       onPressed: (){
            //         print('menu');
            //       },
            //   ),
            //   IconButton(
            //     icon: Icon(Icons.settings),
            //       onPressed: (){
            //         print('menu');
            //       },
            //   ),
            // ],

            // bottom: TabBar(
            //   tabs: <Widget>[
            //     Tab(text: '热门'),
            //     Tab(text: '推荐'),
            //   ],
            // ),

            title: Row(children: <Widget>[
              Expanded(
                child: TabBar(
                  isScrollable: true,
                  indicatorColor: Colors.pink,
                  labelColor: Colors.pink,
                  unselectedLabelColor: Colors.white,
                  indicatorSize: TabBarIndicatorSize.label,
                  tabs: <Widget>[
                    Tab(text: 'tab01'),
                    Tab(text: 'tab02'),
                    Tab(text: 'tab03'),
                    Tab(text: 'tab04'),
                    Tab(text: 'tab05'),
                    Tab(text: 'tab06'),
                  ],
                ),
              )
            ]),
          ),
          body: TabBarView(
            children: <Widget>[
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text('第一个tab'),
                  ),
                  ListTile(
                    title: Text('第一个tab'),
                  ),
                ],
              ),
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text('第二个tab'),
                  ),
                  ListTile(
                    title: Text('第二个tab'),
                  ),
                ],
              ),
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text('第三个tab'),
                  ),
                  ListTile(
                    title: Text('第三个tab'),
                  ),
                ],
              ),
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text('第4个tab'),
                  ),
                  ListTile(
                    title: Text('第4个tab'),
                  ),
                ],
              ),
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text('第5个tab'),
                  ),
                  ListTile(
                    title: Text('第5tab'),
                  ),
                ],
              ),
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text('第6个tab'),
                  ),
                  ListTile(
                    title: Text('第6个tab'),
                  ),
                ],
              ),
            ],
          ),
        ));
  }
}
